import request from '@/utils/axiosRequest.js'


// 模糊查询
export function getAddressesByConditions(params) {
  let url = "/system/address/condition";
  if (params) {
    url += "?dorm=" + (params.dorm ? params.dorm : "")
      + "&room=" + (params.room ? params.room : "")
      + "&pageNo=" + (params.pageNo ? params.pageNo : "")
      + "&pageSize=" + (params.pageSize ? params.pageSize : "")
  }
  return request({
    url: url,
    method: "get"
  })
}

// 楼区的全部楼舍
export function getDormList() {
  return request({
    url: "/system/address/dorm",
    method: "get"
  })
}

// 查询楼舍的所有寝室
export function getRoomsOfDorm(dorm) {
  return request({
    url: "/system/address/room/" + dorm,
    method: "get"
  })
}

// 添加
export function addAddress(address) {
  return request({
    url: "/system/address",
    method: "post",
    data: address
  })
}

// 更新
export function updateAddress(address) {
  return request({
    url: "/system/address",
    method: "put",
    data: address
  })
}

// 批量删除
export function deleteAddresss(addressIdList) {
  return request({
    url: "/system/address/batch",
    method: "delete",
    data: addressIdList
  })
}

// 改变叫水状态
export function changeTaskStatus(addressId) {
  return request({
    url: "/system/address/taskStatus/" + addressId,
    method: "put"
  })
}
